/**
 * 
 */
package com.and.xmppsdk.adapter;

import com.and.xmppsdk.fragment.ContactsFragment;
import com.and.xmppsdk.fragment.SessionFragment;
import com.and.xmppsdk.fragment.SettingsFragment;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * @author hljdrl@gmail.com
 * 
 */
public class HomeFtAdapter extends FragmentPagerAdapter {

	private String[] TITLES;

	public HomeFtAdapter(FragmentManager fm) {
		super(fm);
	}

	public HomeFtAdapter(FragmentManager fm, String[] titles) {
		super(fm);
		TITLES = titles;
	}

	@Override
	public Fragment getItem(int arg0) {
		switch (arg0) {
		case 0:

			return new SessionFragment();
		case 1:

			return new ContactsFragment();
		case 2:

			return new SettingsFragment();
		}
		return null;
	}

	@Override
	public int getCount() {
		return TITLES.length;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return TITLES[position % TITLES.length];
	}

}
